package com.xuelang.pipeline.domain.resource.service;

import com.xuelang.pipeline.client.common.result.PageRecord;
import com.xuelang.pipeline.client.resource.dto.EnvironmentQuery;
import com.xuelang.pipeline.domain.resource.Environment;

import java.util.List;

/**
 * 环境领域服务类
 *
 * @author xiwen.zxg
 * @since 2024/5/15
 */
public interface EnvironmentDomainService {
    /**
     * 获取环境列表，有过滤条件
     *
     * @param currentPage
     * @param pageSize
     * @param environmentQuery
     * @return
     */
    PageRecord<Environment> pageList(long currentPage, long pageSize, EnvironmentQuery environmentQuery);
    /**
     * 获取环境列表，有过滤条件
     *
     * @param environmentQuery
     * @return
     */
    List<Environment> list(EnvironmentQuery environmentQuery);

    /**
     * 新增环境
     *
     * @param environment
     * @return
     */
    Boolean save(Environment environment);

    /**
     * 更新环境
     *
     * @param environment
     * @return
     */
    Boolean update(Environment environment);
    /**
     * 删除环境
     *
     * @param uuid
     * @return
     */
    Boolean delete(String uuid);

    /**
     * 判断环境编码是否存在
     *
     * @param applicationCode
     * @param environmentCode
     * @return
     */
    Boolean existsCode(String applicationCode, String environmentCode);

    /**
     * 判断环境名称是否存在
     *
     * @param applicationCode
     * @param environmentCode
     * @param environmentName
     * @return
     */
    Boolean existsName(String applicationCode, String environmentCode, String environmentName);

    /**
     * 获取环境详情
     *
     * @param uuid
     * @return
     */
    Environment query(String uuid);

    /**
     * 判断是否有关联spaceUuid的环境
     *
     * @param spaceUuid
     * @return
     */
    Boolean existsEnvironmentBySpaceUuid(String spaceUuid);

    /**
     * 根据应用编码删除环境列表
     *
     * @param applicationCode
     * @return
     */
    Boolean deleteByApplicationCode(String applicationCode);
}
